<?php
 	session_start();
	if (empty($_SESSION['usuario'])){
		session_destroy();
		header("Location:index.php");
	}
	else{
		$tipo=$_GET["tipo"];
		$usuario=$_GET["usuario"];
	}
?>
<html>
	<head>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
		<script type="text/javascript">
			$(function(){
				$('#container').highcharts({
					data:{
						table:document.getElementById('datatable')
					},
					chart:{
						type:'column'
					},
					title:{
						text:'VENTAS DE LIBROS POR TIPO'
					},
					yAxis:{
						allowDecimals: false,
						title:{
							text:'Unidades'
						}
					},
					tooltip:{
						formatter:function() {
							return '<b>'+ this.series.name +'</b><br/>'+
								this.point.y +' '+ this.point.name.toLowerCase();
						}
					}
				});
			});
		</script>
	</head>
	<body>
		<script src="highcharts/js/highcharts.js"></script>
		<script src="highcharts/js/modules/data.js"></script>
		<script src="highcharts/js/modules/exporting.js"></script>
		<?php
			$num_administrador=$_GET["num_administrador"];
			$num_proveedor=$_GET["num_proveedor"];
			$num_cliente=$_GET["num_cliente"];
			echo "<div id=\"container\" style=\"min-width: 310px; height: 545px; margin: 0 auto\"></div>";
			echo "<table id=\"datatable\">";
				echo "<thead>";
					echo "<tr>";
						echo "<th></th>";
						echo "<th>Libros vendidos</th>";
					echo "</tr>";
				echo "</thead>";
				echo "<tbody>";
					echo "<tr>";
						echo "<th align=\"left\">Administradores</th>";
						echo "<td align=\"right\">$num_administrador</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align=\"left\">Proveedores</th>";
						echo "<td align=\"right\">$num_proveedor</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align=\"left\">Clientes</th>";
						echo "<td align=\"right\">$num_cliente</td>";
					echo "</tr>";
				echo "</tbody>";
			echo "</table>";
		?>
	</body>
</html>